from app import db

class Notice(db.Model):
    __tablename__ = 'sys_notice'
    notice_pk = db.Column(db.String,primary_key=True)
    notice_content = db.Column(db.String)
    notice_title= db.Column(db.String)
    notice_time = db.Column(db.String)
    notice_person = db.Column(db.String)
    fk_user_pk = db.Column(db.String)
    notice_remark = db.Column(db.String)

    def __repr__(self):
        return '<Notice %r>' % self.notice_pk
    

    def to_dict(items):
        lic = []
        for item in items:
            lic.append(
                {
                    'notice_pk' : item.notice_pk,
                    'notice_content' : item.notice_content,
                    'notice_title': item.notice_title,
                    'notice_time' : item.notice_time,
                    'notice_person' : item.notice_person,
                    'fk_user_pk' : item.fk_user_pk,
                    'notice_remark' : item.notice_remark,
                }
            )
        return lic